<template>
	<view class="article">
		<view class="art-title">{{ title }}</view>
		<view class="time">{{ time }}</view>
		<rich-text :nodes="detailContent"></rich-text>
	</view>
</template>

<script>
	import { articleDetail } from '@/api/order.js'
	export default {
		data() {
			return {
				detailContent: '',
				title: '',
				time: '',
				paramObj: ''
			}
		},
		onLoad(param) {
			const strObj = JSON.parse(decodeURIComponent(param.data));
			const contentData = Object.assign({}, strObj)
			this.paramObj = contentData
		 console.log('Object.assign({}, strObj)', Object.assign({}, strObj))
			this.detailContent = contentData.content;
			this.title = contentData.title;
			this.time = contentData.updatetime.text;
			this.getDetail(contentData.id)
		},
		onShareTimeline() {
			return {
				title: '文章详情',
				query: 'data=' + this.paramObj
			}
		},
		onShareAppMessage() {
			return {
				title: '文章详情',
				path: '/pages/articleDetail/index'
			}
		},
		methods: {
			getDetail(id) {
				articleDetail({id: id}).then(detail => {
					console.log('detail', detail)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.article {
		margin: 20rpx 36rpx;
		
		.art-title {
			font-size: 32rpx;
			color: #333;
			line-height: 52rpx;
		}
		.time {
			font-size: 24rpx;
			color: #999;
			margin-top: 20rpx;
			margin-bottom: 40rpx;
		}
	}
</style>